package com.ms.hotevent.service;

import com.ms.hotevent.dao.CommentDao;
import com.ms.hotevent.entity.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class CommentService {

    @Autowired
    CommentDao commentDao;

    public List<Comment> getComments(Integer eventId){
        return commentDao.getComments(eventId);
    }

    public boolean add(Comment comment){
        try {
            comment.setCreateTime(new Date());
            commentDao.add(comment);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}
